package cosplay.Services;

import java.sql.Timestamp;

import cosplay.beans.Votes;

public class VoteServices {
	//return null if unavailable or initialized vote
	public static Votes VoteVerify(Votes vote)
	{
		Timestamp now = new Timestamp(System.currentTimeMillis());
		if (vote.getCompetitionID()<=0)
			return null;
		if (vote.getPhotoID()<=0)
			return null;
		if (vote.getUserID()<=0)
			return null;
		if (vote.getVotedate().after(now))
			vote.setVotedate(now);
		if (vote.getVoteIP()==null)
			vote.setVoteIP("");
		if (vote.getVoteRank()<=0)
			return null;
		return vote;
	}

}
